home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12670 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  41 lines

  1. Path: news2.compulink.com!not-for-mail
  2. Newsgroups: comp.lang.c++
  3. From: pandora@cml.com (Chantal Marier)
  4. Subject: Help with calling batch files from Borland C++
  5. Content-Type: Text/Plain; charset=US-ASCII
  6. MIME-Version: 1.0
  7. X-Newsreader: WinVN 0.99.6
  8. X-Client-Port: 1070
  9. Message-ID: <ragnaroek1996Mar20.184656.11284@news2.compulink.com>
  10. X-Nntp-Posting-Host: slip4.cml.com
  11. Date: 20 Mar 96 23:46:56 GMT
  12.  
  13. I am hoping that someone will be able to help me with a program that I have 
  14. made.  It almost works except for the fact that it only reads the batch file in 
  15. question instead of calling the batch file.  I am using Borland C++ and my 
  16. program follows.
  17.  
  18. #include <stdio.h>
  19.  
  20.     FILE *filePtr;                    /* Defines a file 
  21. pointer */
  22.  
  23. main()
  24. {
  25.     filePtr = fopen("menu.bat", "r");         /* Opens file for 
  26. reading */
  27.     if (filePtr == NULL)
  28.         { printf("Error opening file.\n"); }    /* Displays error 
  29. message if                             file does not 
  30. open */
  31.     else
  32.     { fclose(filePtr);                /* Closes file */
  33.         printf("Program complete.\n"); }
  34. return 0;
  35. }
  36.  
  37. If anyone out there knows how to do what I need to do, please, PLEASE let me 
  38. know how to do this darn program.  I am just learning how to program and your 
  39. help would be greatly appreciated.  :)
  40.  
  41.